/*
 * @Authoryour name
 * @Date2020-12-03 23:40:18
 * @LastEditTime2020-12-03 23:40:18
 * @LastEditorsyour name
 * @DescriptionIn User Settings Edit
 * @FilePath\STM32H750_FreeRTOS\User\application\backtrace\backtrace.h
 */ 
#ifndef BACKTRACE_H_
#define BACKTRACE_H_

#include "common_types.h"
#include "FreeRTOS.h"

#ifndef CMB_CSTACK_BLOCK_NAME
#define CMB_CSTACK_BLOCK_NAME          STACK
#endif

#ifndef CMB_CODE_SECTION_NAME
#define CMB_CODE_SECTION_NAME          ER_IROM1
#endif

#define SECTION_START(_name_)                _name_##$$Base
#define SECTION_END(_name_)                  _name_##$$Limit
#define IMAGE_SECTION_START(_name_)          Image$$##_name_##$$Base
#define IMAGE_SECTION_END(_name_)            Image$$##_name_##$$Limit
#define CSTACK_BLOCK_START(_name_)           SECTION_START(_name_)
#define CSTACK_BLOCK_END(_name_)             SECTION_END(_name_)
#define CODE_SECTION_START(_name_)           IMAGE_SECTION_START(_name_)
#define CODE_SECTION_END(_name_)             IMAGE_SECTION_END(_name_)


#define BACKTRACE_CALL_NUM                   10
#define BACKTRACE_DS_NUM_PER_LINE            4
#define BACKTRACE_DUMP_STACK_ENABLE          FALSE

extern const int CSTACK_BLOCK_START(CMB_CSTACK_BLOCK_NAME);
extern const int CSTACK_BLOCK_END(CMB_CSTACK_BLOCK_NAME);
extern const int CODE_SECTION_START(CMB_CODE_SECTION_NAME);
extern const int CODE_SECTION_END(CMB_CODE_SECTION_NAME);                             

extern void backtrace_init(void);
extern void backtrace_assert(uint32_t sp);


#endif

